package com.cn.wanxi.servlet.manage.user;

import com.cn.wanxi.model.UserModel;
import com.cn.wanxi.service.IUserService;
import com.cn.wanxi.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/updateUser")
public class UserUpdateServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id=req.getParameter("id");
        String username=req.getParameter("username");
        String password=req.getParameter("password");


        UserModel userModel=new UserModel();
        userModel.setId(Integer.parseInt(id));
        userModel.setUsername(username);
        userModel.setPassword(password);

        IUserService iUserService=new UserServiceImpl();
        iUserService.update(userModel);

    }
}
